load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "streamclient",
    srcs = [
        "client.go",
        "client_helpers.go",
        "heartbeat_sender.go",
        "mock_stream_client.go",
        "partitioned_stream_client.go",
        "pgconn.go",
        "random_client.go",
        "span_config_stream_client.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/crosscluster/streamclient",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/ccl/crosscluster",
        "//pkg/cloud/externalconn",
        "//pkg/jobs/jobspb",
        "//pkg/kv/kvpb",
        "//pkg/repstream/streampb",
        "//pkg/roachpb",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/isql",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/util/ctxgroup",
        "//pkg/util/hlc",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/span",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_golang_snappy//:snappy",
        "@com_github_jackc_pgconn//:pgconn",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_pkg_errors//:errors",
    ],
)

go_test(
    name = "streamclient_test",
    size = "medium",
    srcs = [
        "client_test.go",
        "heartbeat_sender_test.go",
        "main_test.go",
        "partitioned_stream_client_test.go",
        "span_config_stream_client_test.go",
    ],
    embed = [":streamclient"],
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/ccl/crosscluster",
        "//pkg/ccl/crosscluster/replicationtestutils",
        "//pkg/ccl/kvccl/kvtenantccl",
        "//pkg/ccl/storageccl",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/repstream/streampb",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/testutils",
        "//pkg/testutils/jobutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/cancelchecker",
        "//pkg/util/ctxgroup",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/span",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_lib_pq//:pq",
        "@com_github_stretchr_testify//require",
    ],
)
